package com.iris.live.services.data.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;

/**
 * Created by xin on 2016/7/31.
 */
@SuppressWarnings("JpaDataSourceORMInspection")
@Entity
@Table(name = "LSH金融机构设置", schema = "sg_lsh", catalog = "")
public class Lsh金融机构设置Model {
    private Integer 金融机构编号;
    private String 金融机构;
    private String 许可;
    private String brand;
    private String applicableArea;
    private String applicableStore;
    private String 状态;
    private Integer type;
    private String 更新账号;
    private Timestamp 更新时间;
    private 用户SimpleModel 用户;
    private List<Lsh金融机构手续费Model> lsh金融机构手续费List;
    private List<Lsh金融季度额外奖励Model> lsh金融季度额外奖励List;

    @ManyToOne
    @JoinColumns(
            value = {
                    @JoinColumn(referencedColumnName = "许可", name = "许可", insertable = false, updatable = false),
                    @JoinColumn(referencedColumnName = "用户名", name = "更新账号", insertable = false, updatable = false)
            }
    )
    @JsonProperty("用户")
    public 用户SimpleModel get用户() {
        return 用户;
    }

    @JsonIgnore
    public void set用户(用户SimpleModel 用户) {
        this.用户 = 用户;
    }

    @OneToMany
    @JoinColumn(referencedColumnName = "金融机构编号", name = "金融机构编号", insertable = false, updatable = false)
    @JsonIgnore
    public List<Lsh金融机构手续费Model> getLsh金融机构手续费List() {
        return lsh金融机构手续费List;
    }

    @JsonProperty("手续费收取")
    public void setLsh金融机构手续费List(List<Lsh金融机构手续费Model> lsh金融机构手续费List) {
        this.lsh金融机构手续费List = lsh金融机构手续费List;
    }

    @OneToMany
    @JoinColumn(referencedColumnName = "金融机构编号", name = "金融机构编号", insertable = false, updatable = false)
    @JsonIgnore
    public List<Lsh金融季度额外奖励Model> getLsh金融季度额外奖励List() {
        return lsh金融季度额外奖励List;
    }

    @JsonProperty("季度额外奖励")
    public void setLsh金融季度额外奖励List(List<Lsh金融季度额外奖励Model> lsh金融季度额外奖励List) {
        this.lsh金融季度额外奖励List = lsh金融季度额外奖励List;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "金融机构编号")
    public Integer get金融机构编号() {
        return 金融机构编号;
    }

    public void set金融机构编号(Integer 金融机构编号) {
        this.金融机构编号 = 金融机构编号;
    }

    @Basic
    @Column(name = "金融机构")
    public String get金融机构() {
        return 金融机构;
    }

    public void set金融机构(String 金融机构) {
        this.金融机构 = 金融机构;
    }

    @Basic
    @Column(name = "许可")
    public String get许可() {
        return 许可;
    }

    public void set许可(String 许可) {
        this.许可 = 许可;
    }

    @Basic
    @Column(name = "状态")
    public String get状态() {
        return 状态;
    }

    public void set状态(String 状态) {
        this.状态 = 状态;
    }

    @Basic
    @Column(name = "brand")
    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    @Basic
    @Column(name = "applicable_area")
    public String getApplicableArea() {
        return applicableArea;
    }

    public void setApplicableArea(String applicableArea) {
        this.applicableArea = applicableArea;
    }

    @Basic
    @Column(name = "applicable_store")
    public String getApplicableStore() {
        return applicableStore;
    }

    public void setApplicableStore(String applicableStore) {
        this.applicableStore = applicableStore;
    }

    @Basic
    @Column(name = "type")
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Basic
    @Column(name = "更新账号")
    public String get更新账号() {
        return 更新账号;
    }

    public void set更新账号(String 更新账号) {
        this.更新账号 = 更新账号;
    }

    @Basic
    @Column(name = "更新时间")
    public Timestamp get更新时间() {
        return 更新时间;
    }

    public void set更新时间(Timestamp 更新时间) {
        this.更新时间 = 更新时间;
    }

    @PrePersist
    @PreUpdate
    public void onPreUpdate() {
        this.set更新时间(new Timestamp(System.currentTimeMillis()));
    }

}
